package cn.edu.cdu.group4nb.service.impl;

import cn.edu.cdu.group4nb.mapper.RoleMapper;
import cn.edu.cdu.group4nb.po.RoleInf;
import cn.edu.cdu.group4nb.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @auther: tupeng
 * @date: 2019-10-10 13:01
 */
@Service
public class RoleServiceImpl implements RoleService {

    private final RoleMapper roleMapper;

    @Autowired
    public RoleServiceImpl(RoleMapper roleMapper) {
        this.roleMapper = roleMapper;
    }

    @Override
    public void addRole(String rolename,String roledetail) {
        roleMapper.addRole(rolename,roledetail);
    }

    @Override
    public void deleteRole(int[] roleid) {
//        for(String rname:rolename){
//            roleMapper.deleteRole(rname);
//        }
        roleMapper.deleteRole(roleid);
    }

    @Override
    public List<RoleInf> queryAllRole() {
        return roleMapper.queryAllRole();
    }

    @Override
    public RoleInf queryRoleById(int roleid) {
        return roleMapper.queryRoleById(roleid);
    }

    @Override
    public void updateRole(String rolename,String roledetail,String roleid) {
        roleMapper.updateRole(rolename,roledetail,roleid);
    }


}
